#ifndef __AD9833_H
#define __AD9833_H
#include "sys.h"

/* I/O Configuration */
#define AD9833_FSYNC_Port GPIOD
#define AD9833_FSYNC_GPIOClock RCC_AHB1Periph_GPIOD
#define AD9833_FSYNC_PIN GPIO_Pin_11

#define AD9833_SDATA_Port GPIOB  
#define AD9833_SDATA_GPIOClock RCC_AHB1Periph_GPIOB
#define AD9833_SDATA_PIN GPIO_Pin_13

#define AD9833_SCLKC_Port GPIOB
#define AD9833_SCLK_GPIOClock RCC_AHB1Periph_GPIOB
#define AD9833_SCLK_PIN GPIO_Pin_14

#define AD9833_CS_Port GPIOD
#define AD9833_CS_GPIOClock RCC_AHB1Periph_GPIOD
#define AD9833_CS_PIN GPIO_Pin_13

#define AD9833_FSYNC_ON GPIO_SetBits(AD9833_FSYNC_Port,AD9833_FSYNC_PIN)
#define AD9833_FSYNC_OFF GPIO_ResetBits(AD9833_FSYNC_Port,AD9833_FSYNC_PIN)

#define AD9833_SDATA_ON GPIO_SetBits(AD9833_SDATA_Port,AD9833_SDATA_PIN)
#define AD9833_SDATA_OFF GPIO_ResetBits(AD9833_SDATA_Port,AD9833_SDATA_PIN)

#define AD9833_SCLK_ON  GPIO_SetBits(AD9833_SCLKC_Port,AD9833_SCLK_PIN)
#define AD9833_SCLK_OFF GPIO_ResetBits(AD9833_SCLKC_Port,AD9833_SCLK_PIN)

#define AD9833_CS_ON  GPIO_SetBits(AD9833_CS_Port,AD9833_CS_PIN)
#define AD9833_CS_OFF GPIO_ResetBits(AD9833_CS_Port,AD9833_CS_PIN)

void AD9833_Init(void);
void AD9833_Write(uint16_t DATA);
void AD9833_Frequnce_SIN(float data);
void AD9833_Frequnce_TRI(float data);
void AD9833_Frequnce_SQU(float data);
void AD9833_Amplitude_Write(unsigned char x);
void AD9833_Amplitude_Set(float res);
void AD9833_stask(void *pvParameters);
#endif
